home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 353_02 / funcpnt.cpp < prev    next >
C/C++ Source or Header  |  1992-01-18  |  1KB  |  52 lines

  1.                                       // Chapter 3 - Program 3
  2. #include <stdio.h>
  3.  
  4. void print_stuff(float data_to_ignore);
  5. void print_message(float list_this_data);
  6. void print_float(float data_to_print);
  7. void (*function_pointer)(float);
  8.  
  9. main()
  10. {
  11. float pi = 3.14159;
  12. float two_pi = 2.0 * pi;
  13.  
  14.    print_stuff(pi);
  15.    function_pointer = print_stuff;
  16.    function_pointer(pi);
  17.    function_pointer = print_message;
  18.    function_pointer(two_pi);
  19.    function_pointer(13.0);
  20.    function_pointer = print_float;
  21.    function_pointer(pi);
  22.    print_float(pi);
  23. }
  24.  
  25.  
  26. void print_stuff(float data_to_ignore)
  27. {
  28.    printf("This is the print stuff function.\n");
  29. }
  30.  
  31.  
  32. void print_message(float list_this_data)
  33. {
  34.    printf("The data to be listed is %f\n", list_this_data);
  35. }
  36.  
  37.  
  38. void print_float(float data_to_print)
  39. {
  40.    printf("The data to be printed is %f\n", data_to_print);
  41. }
  42.  
  43.  
  44. // Result of execution
  45. //
  46. // This is the print stuff function.
  47. // This is the print stuff function.
  48. // The data to be listed is 6.283180
  49. // The data to be listed is 13.000000
  50. // The data to be printed is 3.141590
  51. // The data to be printed is 3.141590
  52.